package com.example.springmvc.exception;

import com.example.springmvc.common.ResultCode;

/**
 * 全局自定义异常
 *
 * @author shine
 */
public class BusinessException extends RuntimeException {

    private Integer code;

    public BusinessException(int code, String message) {
        super(message);
        this.code = code;
    }

    public BusinessException(ResultCode result) {
        this(result.getCode(), result.getMsg());
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }
}
